﻿//=====================================================
// Copyright © 2017-2018 xuxuzhaozhao
// All rights reserved
// GUID: 84386019-a1b2-4dc6-9fe2-ac446eb403cf
// CLR版本: 4.0.30319.42000
// 命名空间名称: xuxuzhaozhao.Blog.Infrastructure
// 文件名: XuResult
// 当前系统时间: 2017/11/7 11:11:17
// 当前登录用户名: xuxuzhaozhao
//======================================================


namespace xuxuzhaozhao.Blog.Infrastructure.XuTools
{
    public class XuResult
    {
        public XuResult() { }

        public XuResult(string message, StatusCode code, object data)
        {
            Message = message;
            Code = code;
            Data = data;
        }
        public StatusCode Code { get; set; } = StatusCode.Success;
        public string Message { get; set; } = "操作成功。";
        public object Data { get; set; }

        public XuResult Success()
        {
            return this;
        }
        public XuResult Fail()
        {
            this.Code=StatusCode.Fail;
            this.Message = "操作失败。";
            return this;
        }
    }

    public enum StatusCode
    {
        Success = 1,
        Fail = -1
    }
}
